import React, { Component } from 'react';
import Table from '../../../components/table';
import { querybase } from '../../../services/operator';

class MyTable extends Table {
	columns = [
		{
			title: '供应商名称',
			dataIndex: 'name',
			key: 'name'
		},
		{
			title: '所属省市',
			dataIndex: 'area',
			key: 'area',
			render: (area, d) => `${d.province}/${d.city}/${area || ''}`
		}
	]
	async queryData(data) {
		// 调用请求
		return querybase(data);
	}

	merge() {
		const { current, size } = this.state;
		const { queryData } = this.props;
		const data = {};
		for (const k in queryData) {
			queryData[k] || queryData[k] === 0 ? data[k] = queryData[k] : null;
		}
		return { query: { ...data }, current, size };
	}
}

export default MyTable;
